Website Hosting

By bigspotteddog

What is GitHub Pages?

GitHub Pages is a free hosting option offered by GitHub. You can add your custom domain and GitHub provides the SSL certificate for free as well.

1. Set up a GitHub account

To begin, sign up for a GitHub account (if you don't already have one) at https://github.com.

Sign up for GitHub or Sign in
Sign up for GitHub or Sign in

2. Add a new repository

Next, add a new repository to your GitHub account.

Add a new repository for your website
Add a new repository for your website

3. Add your website files

  1. Click Add file
  2. Click Upload files
Add your website's files
Add your website's files

4. Select your website files

Select all of the files and folders for your website
Select all of the files and folders for your website

5. Drag and drop your files

Drag and drop your files into the GitHub add files dialog.

Drag and drop all of your website's file and progress will be shown
Drag and drop all of your website's file and progress will be shown

6. Commit your files to complete the upload

  1. Scroll to the bottom of the upload files page
  2. Enter a commit message (ex. "Add website files")
  3. Click the Commit changes button
Commit your changes to add your files
Commit your changes to add your files

7. Go to the Settings page for your repository

On your website's repository page, click the Settings button.

Click Settings
Click Settings

8. Go to Pages

On the repository settings page, click Pages.

Click Pages
Click Pages

9. Set up Pages for your website

  1. Select branch main
  2. Click Save
Configure Pages for your website
Configure Pages for your website

Your site is automatically assigned to:
https://<your github username>.github.io/<repository name>

Your website is now available on the internet
Your website is now available on the internet

10. Add your custom domain

If you have your own custom domain, go to your DNS server and configure an CNAME record for your domain (ex. blog.example.com) and give it this value:

.github.io

I use AWS so mine looks like this.

CNAME record on AWS
CNAME record on AWS

11. Add your custom domain to GitHub Pages

  1. Enter your custom domain
  2. Click Save
Configure custom domain
Configure custom domain

12. Enable HTTPS

Once your domain is validated, you can enable Enforce HTTPS.

Enable HTTPS only
Enable HTTPS only

Now your website is running securely on https://<your custom domain>.

All done.